
#import "YDUITabBarViewController.h"
@implementation YDUITabBarViewController

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
        [self didInitialized];
    }
    return self;
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    if (self = [super initWithCoder:aDecoder]) {
        [self didInitialized];
    }
    return self;
}

- (void)didInitialized {
    // UIView.tintColor 并不支持 UIAppearance 协议，所以不能通过 appearance 来设置，只能在实例里设置
    self.tabBar.tintColor = UIColorMake(248, 107, 107);//TabBarTintColor;
}

- (void)viewWillLayoutSubviews{
    
    CGRect tabFrame = self.tabBar.frame; //self.TabBar is IBOutlet of your TabBar
    tabFrame.size.height = 70;
    tabFrame.origin.y = self.view.frame.size.height - 70;
    self.tabBar.frame = tabFrame;
    
    [self.tabBar.items enumerateObjectsUsingBlock:^(UITabBarItem * _Nonnull item, NSUInteger idx, BOOL * _Nonnull stop) {
        
        if (idx == 2)
        {
            item.imageInsets = UIEdgeInsetsMake(-5, -3, 5, -3);
        }
        else
        {
            item.imageInsets = UIEdgeInsetsMake(-7, -3, 7, -3);
        } 
    }];
}

#pragma mark - 屏幕旋转

- (BOOL)shouldAutorotate {
    return [self.selectedViewController qmui_hasOverrideUIKitMethod:_cmd] ? [self.selectedViewController shouldAutorotate] : YES;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
    return [self.selectedViewController qmui_hasOverrideUIKitMethod:_cmd] ? [self.selectedViewController supportedInterfaceOrientations] : SupportedOrientationMask;
}

@end
